Skip to content

fix(ruby): adjust specifity of word characters - #336

Open
AlternateRT wants to merge 1 commit into
zed-extensions:mainfrom
AlternateRT:adjust-word-characters
Open

AlternateRT wants to merge 1 commit into
zed-extensions:mainfrom
AlternateRT:adjust-word-characters

Conversation

@AlternateRT

Copy link
Copy Markdown
Contributor

Only treat ! and ? as word characters when used in identifiers, symbols, hash key symbols, or the defined? method

Only treat `!` and `?` as word characters when used in identifiers,
symbols, hash key symbols, or the `defined?` method
@cla-bot cla-bot Bot added the cla-signed label Sep 19, 2026

@vitallium vitallium left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I left just one suggestion about extending the capture to support more scenarios. Happy to hear your thoughts.

Side note: I think we have an issue with our CI configuration, as I’m pretty sure the changes in this PR should cause our snapshot tests to fail.

Comment on lines +6 to +11
[
(identifier)
(simple_symbol)
(hash_key_symbol)
"defined?"
] @identifier

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: should we also add delimited_symbol and bare_symbol to handle use cases like :"ready?" or symbol arrays?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually left those out intentionally.

Delimited symbols and symbol arrays allow you to use any arbitrary non-alphabetic character (e.g. :"symbol-with-dashes! and spaces?") as well as string interpolation - none of those will be treated as word characters, which is why I don't think we should give special treatment to ! and ? in this situation

After all, you won't be able to select the entire symbol with a double click like you would with a non-delimited one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants